/**
 * Created by lobin on 2017/7/24.
 */
import { Application } from 'egg';
import * as pageFindPlugin from 'mongoose-paginate';
export default (app: Application) => {
  const mongoose = app.mongoose;
  const schema = new mongoose.Schema({
    subscribe: Number,
    site: { type: String, ref: 'Site' },
    openid: String,
    nickname: String,
    sex: Number,
    language: String,
    city: String,
    province: String,
    country: String,
    headimgurl: String,
    subscribe_time: Number,
    remark: String,
    bondphones: { type: Array, default: [] },
    groupid: Number,
    tagid_list: [],
  });
  schema.plugin(pageFindPlugin, { limit: 20 });
  return mongoose.model('Weixinuser', schema, 'weixinuser');
};
